package com.zmx.job.admin.service;

import com.zmx.job.admin.conf.LoginConfig;
import com.zmx.job.admin.controller.handler.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @Description: 登录实现类
 * @ClassName: LoginService
 * @Author zhaomxr
 * @Date 2021-12-22 10:33
 */
@Service
public class LoginService {

    @Autowired
    private LoginConfig loginConfig;

    public ResponseResult login(String username, String password) {

        String formUser = username.trim() + password.trim();
        String realUser = loginConfig.getUsername() + loginConfig.getPassword();

        if (!Objects.equals(formUser, realUser)) {
            return ResponseResult.fail("用户名密码错误");
        }

        return ResponseResult.success("登录成功");
    }
}
